<?php

namespace App\Http\Controllers\Api;

use App\Repositories\OrderRepository;
use App\Http\Services\AliCloudService;
use Exception;
use Cache;

class TestController extends MiniAppController
{
    private $memberRep = NULL;

    public function __construct()
    {
        parent::__construct();
    }

    public function index()
    {
        echo " ppc  api begin";
        die();
    }

    /**
     * thomashtao
     */
    public function tao()
    {

        dd();

        $aliService = new AliCloudService();

        try {
            $res = $aliService->authIdcard("陶双虎","340823198708232935");
            if(!$res['success']){
                return retFail($res['msg']);
            }

            //处理业务逻辑 ToDo
            $sex = $res['data']['sex'] == '男'?"M": ($res['data']['sex'] == '女' ? 'F':'');
            $birthday = substr($res['data']['birthday'], 0,4) . '-' . substr($res['data']['birthday'],4,2) . '-' . substr($res['data']['birthday'], 6,2);

            dd($sex .', 生日：' . $birthday);
        } catch (Exception $e) {
            return retFail($e->getMessage());
        }

    }

    public function test()
    {
        // $order = (new OrderRepository())->updateOrder("wx" . time(), "20230709215226366565");

        dd(1);
    }

}

